package main

import "fmt"

type House struct {
	Door   string
	Window string
}

type HouseBuilder interface {
	BuildDoor(val string)
	BuildWindow(val string)
	Builder(door string, window string) *House
}

type HouseBuilderImpl struct {
	House *House
}

func (m *HouseBuilderImpl) BuildDoor(val string) {
	m.House.Door = val
	fmt.Println("门创建成功")
}

func (m *HouseBuilderImpl) BuildWindow(val string) {
	m.House.Window = val
	fmt.Println("窗户创建成功")
}

func (m *HouseBuilderImpl) Builder(door string, window string) *House {
	m.BuildDoor(door)
	m.BuildWindow(window)
	return m.House
}

func NewHouseBuilder() HouseBuilder {
	return &HouseBuilderImpl{
		House: &House{},
	}
}

func main() {
	house := NewHouseBuilder().Builder("门", "窗户")
	fmt.Println(house)
}
